package com.mqy.ssm.dto;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.mqy.ssm.utlic.ResultCode;

/**
 * @author 13159 //作者
 * @version V1.0 //版本
 * @Project case1
 * @Package com.mqy.ssm.dto
 * @Description:
 * @Date 2022/3/10 10:33//日期
 * @Motto:放下杂念,只为迎接明天更好的自己
 */
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class Result {
    private int code;

    private String msg;

    private Object data;


    public static Result setOK() {
        return setOK(null);
    }

    public static Result setOK(Object data) {
        return setOK(ResultCode.SUCCESS, "success", data);
    }

    public static Result setOK(int code, String msg, Object data) {
        return setError(code, msg, data);
    }

    public static Result setError(int code, String msg, Object data) {
        Result r = new Result();
        r.setCode(code);
        r.setMsg(msg);
        r.setData(data);
        return r;
    }



    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
